import {mapGetters} from 'vuex';

export default {
	computed: {
		...mapGetters('m_cart', ['total']),
	},
	onShow() {
		this.setBadge();
	},
	watch: {
		total(){
			this.setBadge();
		},
	},
	methods: {
		//为 tabBar 购物车的右上角添加文本
		setBadge(){
			uni.setTabBarBadge({
			  index: 2,
			  text: this.total + '',
			});
		},
	},
}